//
//  QJCoreScanVC.m
//  QuanJieShopProject
//
//  Created by 刘中义 on 2018/2/28.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "QJCoreScanVC.h"
#import "QR_Bar_ScanView.h"
#import "QJCodePayVC.h"
@interface QJCoreScanVC () <QRBarScanViewDelegate>
@property (nonatomic,strong) QR_Bar_ScanView *scanView;
@end

@implementation QJCoreScanVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"扫一扫";
    [self setupScanVCAction];
    
    [YFSaveTool userDefaults:@"rootVC" key:@"KD"];
}
#pragma mark -- 界面布局
- (void)setupScanVCAction{
    [self.view addSubview:self.scanView];
    [self.scanView startScan];
}
#pragma mark -- 2.服从代理 QRBarScanViewDelegate
- (void) scanView:(QR_Bar_ScanView *)scanView codeInfo:(NSString *)codeInfo{
    QJCodePayVC *VC = [[QJCodePayVC alloc]init];
    NSLog(@"codeInfo = %@", codeInfo);
    VC.codeStr = [NSString stringWithFormat:@"%@",codeInfo];
    KPushViewControllerAction(VC);
}
#pragma mark -- 懒加载
- (QR_Bar_ScanView *)scanView{
    if (!_scanView) {
        _scanView = [QR_Bar_ScanView scanViewShowInController:self];
    }
    return _scanView;
}
- (void) dealloc{
    [self.scanView stopScan];
}


@end
